﻿using DLUProject.Domain;
using DLUProject.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ColorLife.Core.Helper;
public partial class KTX_Contact : BaseUserControl
{
    public ModuleInstanceExtension moduleInstance { get; set; }
    public IServices<Pages> _service { get; set; }

    public int IDPage
    {
        get
        {
            if (Request.QueryString["id"] != null)
                return Request.QueryString["id"].ToInt();
            return -1;
        }
    }
   
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        Page.Title = "Liên hệ";
        if (!IsPostBack)
        {

            List<ModuleInstance> modulesLeft = moduleInstance.GetByModulePosition(ModulePosition.Left);
            foreach (var item in modulesLeft)
            {
                BaseUserControl userControlX = (BaseUserControl)LoadControl(item.Module.Path);

                if (userControlX != null)
                {
                    userControlX.ModuleID = item.ModuleInstanceID.ToString();
                    userControlX.Title = item.Title;
                    userControlX.Params = item.Params;
                    userControlX.ShowHide = item.IsActive;
                    userControlX.State = item.State;
                    PlaceHolderLeft.Controls.Add(userControlX);
                }
            }
            var page = _service.Get(IDPage);
            if (page != null)
            {
                lblTieuDe.Text = page.TieuDe;
                lblNoiDung.Text = page.NoiDung;
            }
        }
    }
}